package chatclient;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JMenuItem;

public class ChatClientGUI extends JFrame implements ActionListener {

	static int port = 500;
	static String host = "localhost";

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ChatClientGUI frame = new ChatClientGUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ChatClientGUI() {

		setTitle("\u041C\u043D\u043E\u0433\u043E\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u0447\u0430\u0442");

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 579, 494);

		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);

		JMenu mnNewMenu = new JMenu(
				"\u041E \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0435");

		menuBar.add(mnNewMenu);

		JMenuItem mntmNewMenuItem = new JMenuItem(
				"\u041E \u0447\u0430\u0442\u0435");
		mnNewMenu.add(mntmNewMenuItem);

		mntmNewMenuItem.addActionListener(this);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0, 0));

		ChatClient chatClient = new ChatClient(host, port);
		contentPane.add(chatClient);

		// JPanel panel = new JPanel();
		// contentPane.add(panel, BorderLayout.EAST);
		// panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

		/*
		 * JButton btnNewButton = new JButton("New button");
		 * btnNewButton.addActionListener(new ActionListener() { public void
		 * actionPerformed(ActionEvent arg0) {
		 * 
		 * } }); btnNewButton.setVerticalAlignment(SwingConstants.TOP);
		 * panel.add(btnNewButton);
		 */
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub

		// MyDialog.showDialog(this);
		About.showDialog(this);

	}

}
